package com.etc.controller;

import com.etc.entity.Scenic;
import com.etc.entity.Travels;
import com.etc.service.TravelsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * 用户个人中心控制器
 */
@Controller
@RequestMapping("usercenterapi")
public class UserCenterController {


    @Autowired
    private TravelsService ts;


    @RequestMapping(value = "userCenter", method = RequestMethod.GET  )

    public String userCenter() {

        return "usercenter";
    }

    @RequestMapping(value = "userInfo", method = RequestMethod.GET  )
    public String userInfo() {

        return "usercenter_info";
    }

    @RequestMapping(value = "userStrategy", method = RequestMethod.GET  )
    public String userStrategy() {

        return "usercenter_strategy";
    }

    @RequestMapping(value = "userCollection", method = RequestMethod.GET  )
    public String userCollection() {

        return "usercenter_collection";
    }


    @RequestMapping(value = "userDetails/{traid}", method = RequestMethod.GET  )
    public ModelAndView userDetails(@PathVariable("traid")Integer traid) {

        Travels tra=ts.selectByPrimaryKey(traid);
        ModelAndView mv=new ModelAndView("usercenter_details");
        mv.addObject("tra",tra);

        return mv;
    }

}


